package com.usian.listener;

import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class TopicListener {

    @RabbitListener(bindings = @QueueBinding(
            value = @Queue(value = "springboot_queue"),
            exchange = @Exchange(value = "exchange_topic",type = ExchangeTypes.TOPIC),
            key = {"item.*"}
    ))
    public void listen(String msg){
        System.out.println("接收到的信息为："+msg);
    }

}
